# Copyright 2024 Google LLC
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Description:
#   XNNPACK - optimized floating-point neural network operators library

"""Build sources for XNNPACK.

Lists of target-specific sources used to build XNNPACK.
"""

OPERATOR_SRCS = [
    "src/operator-delete.c",
    "src/operator-run.c",
    "src/operators/argmax-pooling-nhwc.c",
    "src/operators/average-pooling-nhwc.c",
    "src/operators/batch-matrix-multiply-nc.c",
    "src/operators/binary-elementwise-nd.c",
    "src/operators/constant-pad-nd.c",
    "src/operators/convolution-nchw.c",
    "src/operators/convolution-nhwc.c",
    "src/operators/deconvolution-nhwc.c",
    "src/operators/dynamic-fully-connected-nc.c",
    "src/operators/fully-connected-nc.c",
    "src/operators/max-pooling-nhwc.c",
    "src/operators/pack-lh.c",
    "src/operators/reduce-nd.c",
    "src/operators/resize-bilinear-nchw.c",
    "src/operators/resize-bilinear-nhwc.c",
    "src/operators/rope-nthc.c",
    "src/operators/slice-nd.c",
    "src/operators/softmax-nc.c",
    "src/operators/transpose-nd.c",
    "src/operators/unary-elementwise-nc.c",
    "src/operators/unpooling-nhwc.c",
]

SUBGRAPH_SRCS = [
    "src/memory-planner.c",
    "src/runtime.c",
    "src/subgraph.c",
    "src/subgraph/argmax-pooling-2d.c",
    "src/subgraph/average-pooling-2d.c",
    "src/subgraph/batch-matrix-multiply.c",
    "src/subgraph/binary.c",
    "src/subgraph/concatenate.c",
    "src/subgraph/convolution-2d.c",
    "src/subgraph/copy.c",
    "src/subgraph/deconvolution-2d.c",
    "src/subgraph/deprecated.c",
    "src/subgraph/depth-to-space-2d.c",
    "src/subgraph/depthwise-convolution-2d.c",
    "src/subgraph/even-split.c",
    "src/subgraph/fully-connected-sparse.c",
    "src/subgraph/fully-connected.c",
    "src/subgraph/max-pooling-2d.c",
    "src/subgraph/pack-lh.c",
    "src/subgraph/reshape-helpers.c",
    "src/subgraph/rope.c",
    "src/subgraph/softmax.c",
    "src/subgraph/space-to-depth-2d.c",
    "src/subgraph/static-constant-pad.c",
    "src/subgraph/static-reduce.c",
    "src/subgraph/static-resize-bilinear-2d.c",
    "src/subgraph/static-slice.c",
    "src/subgraph/static-transpose.c",
    "src/subgraph/subgraph-utils.c",
    "src/subgraph/unary.c",
    "src/subgraph/unpooling-2d.c",
    "src/subgraph/validation.c",
    "src/tensor.c",
]

TABLE_SRCS = [
    "src/tables/exp2-k-over-64.c",
    "src/tables/exp2-k-over-2048.c",
    "src/tables/exp2minus-k-over-4.c",
    "src/tables/exp2minus-k-over-8.c",
    "src/tables/exp2minus-k-over-16.c",
    "src/tables/exp2minus-k-over-32.c",
    "src/tables/exp2minus-k-over-64.c",
    "src/tables/exp2minus-k-over-2048.c",
    "src/tables/vlog.c",
]

LOGGING_SRCS = [
    "src/enums/allocation-type.c",
    "src/enums/datatype-strings.c",
    "src/enums/microkernel-type.c",
    "src/enums/node-type.c",
    "src/enums/operator-type.c",
    "src/log.c",
]

MICROKERNEL_DEFS = [
    "src/f16-avgpool/f16-avgpool-minmax.inc",
    "src/f16-dwconv/f16-dwconv-minmax.inc",
    "src/f16-f32-vcvt/f16-f32-vcvt.inc",
    "src/f16-f32acc-rdsum/f16-f32acc-rdsum.inc",
    "src/f16-f32acc-rsum/f16-f32acc-rsum.inc",
    "src/f16-maxpool/f16-maxpool-minmax.inc",
    "src/f16-qs8-vcvt/f16-qs8-vcvt.inc",
    "src/f16-qu8-vcvt/f16-qu8-vcvt.inc",
    "src/f16-rdminmax/f16-rdmax.inc",
    "src/f16-rdminmax/f16-rdmin.inc",
    "src/f16-rminmax/f16-rmax.inc",
    "src/f16-rminmax/f16-rmin.inc",
    "src/f16-rminmax/f16-rminmax.inc",
    "src/f16-rsum/f16-rsum.inc",
    "src/f16-spmm/f16-spmm-minmax.inc",
    "src/f16-vabs/f16-vabs.inc",
    "src/f16-vapproxgelu/f16-vapproxgelu.inc",
    "src/f16-vbinary/f16-vadd.inc",
    "src/f16-vbinary/f16-vaddc.inc",
    "src/f16-vbinary/f16-vcmul.inc",
    "src/f16-vbinary/f16-vdiv.inc",
    "src/f16-vbinary/f16-vdivc.inc",
    "src/f16-vbinary/f16-vmax.inc",
    "src/f16-vbinary/f16-vmaxc.inc",
    "src/f16-vbinary/f16-vmin.inc",
    "src/f16-vbinary/f16-vminc.inc",
    "src/f16-vbinary/f16-vmul.inc",
    "src/f16-vbinary/f16-vmulc.inc",
    "src/f16-vbinary/f16-vprelu.inc",
    "src/f16-vbinary/f16-vpreluc.inc",
    "src/f16-vbinary/f16-vrdivc.inc",
    "src/f16-vbinary/f16-vrpreluc.inc",
    "src/f16-vbinary/f16-vrsubc.inc",
    "src/f16-vbinary/f16-vsqrdiff.inc",
    "src/f16-vbinary/f16-vsqrdiffc.inc",
    "src/f16-vbinary/f16-vsub.inc",
    "src/f16-vbinary/f16-vsubc.inc",
    "src/f16-vclamp/f16-vclamp.inc",
    "src/f16-vcos/f16-vcos.inc",
    "src/f16-velu/f16-velu.inc",
    "src/f16-vexp/f16-vexp.inc",
    "src/f16-vgelu/f16-vgelu.inc",
    "src/f16-vhswish/f16-vhswish.inc",
    "src/f16-vlrelu/f16-vlrelu.inc",
    "src/f16-vmulcaddc/f16-vmulcaddc.inc",
    "src/f16-vneg/f16-vneg.inc",
    "src/f16-vrnd/f16-vrndd.inc",
    "src/f16-vrnd/f16-vrndne.inc",
    "src/f16-vrnd/f16-vrndu.inc",
    "src/f16-vrnd/f16-vrndz.inc",
    "src/f16-vrsqrt/f16-vrsqrt.inc",
    "src/f16-vsigmoid/f16-vsigmoid.inc",
    "src/f16-vsin/f16-vsin.inc",
    "src/f16-vsqr/f16-vsqr.inc",
    "src/f16-vsqrt/f16-vsqrt.inc",
    "src/f16-vtanh/f16-vtanh.inc",
    "src/f32-avgpool/f32-avgpool-minmax.inc",
    "src/f32-conv-hwc/f32-conv-hwc.inc",
    "src/f32-dwconv/f32-dwconv-minmax.inc",
    "src/f32-dwconv/f32-dwconv.inc",
    "src/f32-f16-vcvt/f32-f16-vcvt.inc",
    "src/f32-maxpool/f32-maxpool-minmax.inc",
    "src/f32-qs8-vcvt/f32-qs8-vcvt.inc",
    "src/f32-qu8-vcvt/f32-qu8-vcvt.inc",
    "src/f32-raddextexp/f32-raddextexp.inc",
    "src/f32-rdminmax/f32-rdmax.inc",
    "src/f32-rdminmax/f32-rdmin.inc",
    "src/f32-rdsum/f32-rdsum.inc",
    "src/f32-rminmax/f32-rmax.inc",
    "src/f32-rminmax/f32-rmin.inc",
    "src/f32-rminmax/f32-rminmax.inc",
    "src/f32-rsum/f32-rsum.inc",
    "src/f32-spmm/f32-spmm-minmax.inc",
    "src/f32-vabs/f32-vabs.inc",
    "src/f32-vapproxgelu/f32-vapproxgelu.inc",
    "src/f32-vbinary/f32-vadd.inc",
    "src/f32-vbinary/f32-vaddc.inc",
    "src/f32-vbinary/f32-vcmul.inc",
    "src/f32-vbinary/f32-vcopysign.inc",
    "src/f32-vbinary/f32-vcopysignc.inc",
    "src/f32-vbinary/f32-vdiv.inc",
    "src/f32-vbinary/f32-vdivc.inc",
    "src/f32-vbinary/f32-vmax.inc",
    "src/f32-vbinary/f32-vmaxc.inc",
    "src/f32-vbinary/f32-vmin.inc",
    "src/f32-vbinary/f32-vminc.inc",
    "src/f32-vbinary/f32-vmul.inc",
    "src/f32-vbinary/f32-vmulc.inc",
    "src/f32-vbinary/f32-vprelu.inc",
    "src/f32-vbinary/f32-vpreluc.inc",
    "src/f32-vbinary/f32-vrcopysignc.inc",
    "src/f32-vbinary/f32-vrdivc.inc",
    "src/f32-vbinary/f32-vrpreluc.inc",
    "src/f32-vbinary/f32-vrsubc.inc",
    "src/f32-vbinary/f32-vsqrdiff.inc",
    "src/f32-vbinary/f32-vsqrdiffc.inc",
    "src/f32-vbinary/f32-vsub.inc",
    "src/f32-vbinary/f32-vsubc.inc",
    "src/f32-vclamp/f32-vclamp.inc",
    "src/f32-vcos/f32-vcos.inc",
    "src/f32-velu/f32-velu.inc",
    "src/f32-vexp/f32-vexp.inc",
    "src/f32-vgelu/f32-vgelu.inc",
    "src/f32-vhswish/f32-vhswish.inc",
    "src/f32-vlog/f32-vlog.inc",
    "src/f32-vlrelu/f32-vlrelu.inc",
    "src/f32-vmulcaddc/f32-vmulcaddc.inc",
    "src/f32-vneg/f32-vneg.inc",
    "src/f32-vrnd/f32-vrndd.inc",
    "src/f32-vrnd/f32-vrndne.inc",
    "src/f32-vrnd/f32-vrndu.inc",
    "src/f32-vrnd/f32-vrndz.inc",
    "src/f32-vrsqrt/f32-vrsqrt.inc",
    "src/f32-vscaleexpminusmax/f32-vscaleexpminusmax.inc",
    "src/f32-vscaleextexp/f32-vscaleextexp.inc",
    "src/f32-vsigmoid/f32-vsigmoid.inc",
    "src/f32-vsin/f32-vsin.inc",
    "src/f32-vsqr/f32-vsqr.inc",
    "src/f32-vsqrt/f32-vsqrt.inc",
    "src/f32-vtanh/f32-vtanh.inc",
    "src/qs8-dwconv/qs8-dwconv-minmax-fp32.inc",
    "src/qs8-dwconv/qs8-dwconv-minmax-rndnu.inc",
    "src/qs8-f16-vcvt/qs8-f16-vcvt.inc",
    "src/qs8-f32-vcvt/qs8-f32-vcvt.inc",
    "src/qs8-packw/qs8-packw.inc",
    "src/qs8-qc4w-packw/qs8-qc4w-packw.inc",
    "src/qs8-qc8w-dwconv/qs8-qc8w-dwconv-minmax-fp32.inc",
    "src/qs8-rdsum/qs8-rdsum-minmax-fp32.inc",
    "src/qs8-rsum/qs8-rsum.inc",
    "src/qs8-vadd/qs8-vadd-minmax.inc",
    "src/qs8-vaddc/qs8-vaddc-minmax.inc",
    "src/qs8-vcvt/qs8-vcvt.inc",
    "src/qs8-vlrelu/qs8-vlrelu.inc",
    "src/qs8-vmul/qs8-vmul-minmax-fp32.inc",
    "src/qs8-vmul/qs8-vmul-minmax-rndnu.inc",
    "src/qs8-vmulc/qs8-vmulc-minmax-fp32.inc",
    "src/qs8-vmulc/qs8-vmulc-minmax-rndnu.inc",
    "src/qs8-vprelu/qs8-vprelu.inc",
    "src/qs8-vpreluc/qs8-vpreluc.inc",
    "src/qs8-vrpreluc/qs8-vrpreluc.inc",
    "src/qu8-dwconv/qu8-dwconv-minmax-fp32.inc",
    "src/qu8-dwconv/qu8-dwconv-minmax-rndnu.inc",
    "src/qu8-f32-vcvt/qu8-f32-vcvt.inc",
    "src/qu8-rdsum/qu8-rdsum.inc",
    "src/qu8-rsum/qu8-rsum.inc",
    "src/qu8-vadd/qu8-vadd-minmax.inc",
    "src/qu8-vaddc/qu8-vaddc-minmax.inc",
    "src/qu8-vcvt/qu8-vcvt.inc",
    "src/qu8-vlrelu/qu8-vlrelu.inc",
    "src/qu8-vmul/qu8-vmul-minmax-fp32.inc",
    "src/qu8-vmul/qu8-vmul-minmax-rndnu.inc",
    "src/qu8-vmulc/qu8-vmulc-minmax-fp32.inc",
    "src/qu8-vmulc/qu8-vmulc-minmax-rndnu.inc",
    "src/qu8-vprelu/qu8-vprelu.inc",
    "src/qu8-vpreluc/qu8-vpreluc.inc",
    "src/qu8-vrpreluc/qu8-vrpreluc.inc",
    "src/s8-maxpool/s8-maxpool-minmax.inc",
    "src/s8-rdminmax/s8-rdmax.inc",
    "src/s8-rdminmax/s8-rdmin.inc",
    "src/s8-rminmax/s8-rmax.inc",
    "src/s8-rminmax/s8-rmin.inc",
    "src/s8-rminmax/s8-rminmax.inc",
    "src/s8-vclamp/s8-vclamp.inc",
    "src/u8-lut32norm/u8-lut32norm.inc",
    "src/u8-maxpool/u8-maxpool-minmax.inc",
    "src/u8-rdminmax/u8-rdmax.inc",
    "src/u8-rdminmax/u8-rdmin.inc",
    "src/u8-rminmax/u8-rmax.inc",
    "src/u8-rminmax/u8-rmin.inc",
    "src/u8-rminmax/u8-rminmax.inc",
    "src/u8-vclamp/u8-vclamp.inc",
    "src/x16-pack-lh/x16-pack-lh.inc",
    "src/x16-packw/x16-packw.inc",
    "src/x16-transposec/x16-transposec.inc",
    "src/x16-x32-packw/x16-x32-packw.inc",
    "src/x24-transposec/x24-transposec.inc",
    "src/x32-pack-lh/x32-pack-lh.inc",
    "src/x32-packb/x32-packb.inc",
    "src/x32-packw/x32-packw.inc",
    "src/qb4-packw/qb4-packw.inc",
    "src/x32-packx/x32-packx.inc",
    "src/x32-transposec/x32-transposec.inc",
    "src/x64-transposec/x64-transposec.inc",
    "src/x8-pack-lh/x8-pack-lh.inc",
    "src/x8-pack-lh/x8-pack-lh-igemm.inc",
    "src/x8-packq/x8-packq.inc",
    "src/x8-packw/x8-packw.inc",
    "src/x8-transposec/x8-transposec.inc",
    "src/xx-fill/xx-fill.inc",
    "src/xx-pad/xx-pad.inc",
    "src/xx-transposev/xx-transposev.inc",
]

MICROKERNEL_HDRS = [
    "src/xnnpack/argmaxpool.h",
    "src/xnnpack/avgpool.h",
    "src/xnnpack/conv.h",
    "src/xnnpack/dwconv.h",
    "src/xnnpack/fill.h",
    "src/xnnpack/gemm.h",
    "src/xnnpack/ibilinear.h",
    "src/xnnpack/igemm.h",
    "src/xnnpack/lut.h",
    "src/xnnpack/maxpool.h",
    "src/xnnpack/packb.h",
    "src/xnnpack/packq.h",
    "src/xnnpack/packw.h",
    "src/xnnpack/packx.h",
    "src/xnnpack/pad.h",
    "src/xnnpack/pack-lh.h",
    "src/xnnpack/ppmm.h",
    "src/xnnpack/quantization.h",
    "src/xnnpack/raddexpminusmax.h",
    "src/xnnpack/raddextexp.h",
    "src/xnnpack/raddstoreexpminusmax.h",
    "src/xnnpack/reduce.h",
    "src/xnnpack/spmm.h",
    "src/xnnpack/transpose.h",
    "src/xnnpack/unpool.h",
    "src/xnnpack/vbinary.h",
    "src/xnnpack/vcvt.h",
    "src/xnnpack/vmulcaddc.h",
    "src/xnnpack/vscaleexpminusmax.h",
    "src/xnnpack/vscaleextexp.h",
    "src/xnnpack/vunary.h",
]
